using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace Kdg.Tools.FilesCopier
{
    public partial class OpenFolder : UserControl
    {
        public OpenFolder()
        {
            InitializeComponent();
        }

        private void btBrowse_Click(object sender, EventArgs e)
        {
            DirectoryInfo dir = null;
            if (!string.IsNullOrEmpty(tbFolder.Text))
            {
                dir = new DirectoryInfo(tbFolder.Text);
                if (dir.Exists)
                    folderBrowserDialog1.SelectedPath = dir.FullName;
            }

            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
                tbFolder.Text = folderBrowserDialog1.SelectedPath;
        }

        public string SelectedPath
        {
            get { return tbFolder.Text; }
            set { tbFolder.Text = value; }
        }
    }
}
